<template>
  <div>
    <h3>商品页面</h3>
    {{ obj }}
    {{ goods_list }}

    <table style="width:1000px;margin:0 auto">
        <tr>
            <th>编号</th>
            <th>名称</th>
            <th>价格</th>
            <th>商品描述</th>
            <th>所属用户外键</th>
        </tr>
        <tr v-for="(item,i) in goods_list" :key="i">
            <td>{{ item.id }}</td>
            <td>{{ item.name }}</td>
            <td>{{ item.price }}</td>
            <td>{{ item.desc}}</td>
            <td> {{ item.kind }}</td>


            
               
        </tr>
    </table>
  </div>
</template>

<script>
import axios  from 'axios'
export default {
    data(){
        return{
            goods_list:[],
            obj:this.$route.params.id
        }
    },
    mounted(){
        this.getGoods()
    },
    methods:{
        getGoods(){
            axios.get('http://127.0.0.1:8000/users/kind/'+this.obj+'/')
            .then(resp=>{
                console.log(resp);
                this.goods_list=resp.data

            })
            .catch(err=>{
                console.log(err);
            })
        }
    }
}
</script>

<style>

</style>